import json

import requests, random
import hashlib

# l1 = []
# urls = [f"https://httpbin.org/get?age={random.randint(1,10)}" for i in range(10)]
#
# for url in urls:
#     if url not in l1:
#         l1.append(url)
#         res = requests.get(url)
#         print(res.json())
#     else:
#         print("已经请求过")
data_url = set()
urls = [f"https://httpbin.org/post?age={random.randint(1,10)}" for i in range(10)]
url = f"https://httpbin.org/post"
datas = [{"id": 110, "value": random.randint(1, 10)} for j in range(10)]
for data in datas:
    data_hash = hashlib.md5(json.dumps(data).encode()).hexdigest()
    if data_hash not in data_url:
        data_url.add(data_hash)
        res = requests.post(url, data=data)
        print(res.json())
    else:
        print("已经请求过")
